//导入request.js请求工具
import request from '@/utils/request.js'

// 获取学生综合信息（包括基本信息、队伍、技能特长等）
export const getStudentMyInfoService = () => {
  return request({
    url: '/students/my-info',
    method: 'GET'
  })
}

// ==================== 获奖情况管理接口 ====================

// 获取学生的所有获奖情况
export const getStudentAwardsService = () => {
  return request.get('/teacher/awards');
}

// 添加获奖情况
export const addStudentAwardService = (awardData) => {
  return request.post('/teacher/awards', awardData, {
    headers: {
      'Content-Type': 'application/json'
    }
  });
}

// 更新获奖情况
export const updateStudentAwardService = (awardId, awardData) => {
  return request.put(`/teacher/awards/${awardId}`, awardData, {
    headers: {
      'Content-Type': 'application/json'
    }
  });
}

// 删除获奖情况
export const deleteStudentAwardService = (awardId) => {
  return request.delete(`/teacher/awards/${awardId}`);
}

// ==================== 参赛经历管理接口 ====================

// 获取学生的所有参赛经历
export const getStudentCompetitionsService = () => {
  return request.get('/teacher/competitions');
}

// 添加参赛经历
export const addStudentCompetitionService = (competitionData) => {
  return request.post('/teacher/competitions', competitionData, {
    headers: {
      'Content-Type': 'application/json'
    }
  });
}

// 更新参赛经历
export const updateStudentCompetitionService = (competitionId, competitionData) => {
  return request.put(`/teacher/competitions/${competitionId}`, competitionData, {
    headers: {
      'Content-Type': 'application/json'
    }
  });
}

// 删除参赛经历
export const deleteStudentCompetitionService = (competitionId) => {
  return request.delete(`/teacher/competitions/${competitionId}`);
}

// ==================== 项目经历管理接口 ====================

// 获取学生的所有项目经历
export const getStudentProjectsService = () => {
  return request.get('/teacher/projects');
}

// 添加项目经历
export const addStudentProjectService = (projectData) => {
  return request.post('/teacher/projects', projectData, {
    headers: {
      'Content-Type': 'application/json'
    }
  });
}

// 更新项目经历
export const updateStudentProjectService = (projectId, projectData) => {
  return request.put(`/teacher/projects/${projectId}`, projectData, {
    headers: {
      'Content-Type': 'application/json'
    }
  });
}

// 删除项目经历  
export const deleteStudentProjectService = (projectId) => {
  return request.delete(`/teacher/projects/${projectId}`);
}

// ==================== 教育背景管理接口 ====================

// 获取学生的所有教育背景
export const getStudentEducationsService = () => {
  return request.get('/students/educations');
}

// 添加教育背景
export const addStudentEducationService = (educationData) => {
  return request.post('/students/educations', educationData, {
    headers: {
      'Content-Type': 'application/json'
    }
  });
}

// 更新教育背景
export const updateStudentEducationService = (educationId, educationData) => {
  return request.put(`/students/educations/${educationId}`, educationData, {
    headers: {
      'Content-Type': 'application/json'
    }
  });
}

// 删除教育背景
export const deleteStudentEducationService = (educationId) => {
  return request.delete(`/students/educations/${educationId}`);
}

// ==================== 基础信息管理接口 ====================

// 更新学生基础信息
export const updateStudentBasicInfoService = (basicInfoData) => {
  return request.put('/students/updateBasicInfo', basicInfoData, {
    headers: {
      'Content-Type': 'application/json'
    }
  });
}

// 提供调用学生登录接口的函数
export const studentLoginService = (loginData) => {
  return request.post('/students/login', loginData, {
    headers: {
      'Content-Type': 'application/json'
    }
  });
}

// 学生注册接口
export const studentRegisterService = (registerData) => {
  return request.post('/students/register', registerData, {
    headers: {
      'Content-Type': 'application/json'
    }
  });
}

// 获取学生信息接口
export const getStudentInfoService = () => {
  return request.get('/students/getStudentInfo');
}

// 获取技能列表接口
export const getSkillsListService = () => {
  return request.get('/skills/list');
}

// 检查学号是否存在
export const checkStudentIdService = (studentId) => {
  return request.get('/students/check-student-id', {
    params: { studentId }
  });
}

// 检查邮箱是否存在
export const checkEmailService = (email) => {
  return request.get('/students/check-email', {
    params: { email }
  });
}
